import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import router from "./router";
import pinia from "./stores";
import CrudTable from "@/components/CrudTable/index.vue";
// 引入 naive-ui
import {
  create, 
  NCard,
  NDataTable,
  NForm,
  NFormItem,
  NInput,
  NSelect,
  NSpace,
  NModal,
  NIcon,
  NPopconfirm,
  NTag,
  NMessageProvider,
  NConfigProvider,
  NMenu,
  NTabs,
  NTabPane,
  NScrollbar,
  NButton,
  NButtonGroup,
  NDropdown,
  NDatePicker,
  NGrid,
  NGridItem,
  NAvatar,
  NDivider,
  NDescriptions,
  NDescriptionsItem,
  NSwitch,
  NColorPicker,
  NRadioGroup,
  NRadio
} from "naive-ui";
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './styles/dark.scss'

const naive = create({
  components: [ 
    NCard,
    NDataTable,
    NForm,
    NFormItem,
    NInput,
    NSelect,
    NSpace,
    NModal,
    NIcon,
    NPopconfirm,
    NTag,
    NMessageProvider,
    NConfigProvider,
    NMenu,
    NTabs,
    NTabPane,
    NButton,
    NButtonGroup,
    NScrollbar,
    NDropdown,
    NDatePicker,
    NGrid,
    NGridItem,
    NAvatar,
    NDivider,
    NDescriptions,
    NDescriptionsItem,
    NSwitch,
    NColorPicker,
    NRadioGroup,
    NRadio
  ],
});

const app = createApp(App);

app.use(router);
app.use(pinia);
app.use(naive);
app.component("CrudTable", CrudTable);

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus)

// 包装应用以支持消息提示
app.mount("#app");
